Add Method (Fields Collection)
The Add
method creates a new Field
Syntax
Set objField = objFieldsColl.Add (name, Class [, value]
[, PropsetID] )
Set objfield = objFieldsColl.Add (PropTag [, value]
)
Parameters
objField
On successful
return, contains the new Field object.
objFieldsColl
Required. The
Fields collection object.
name
Required. A string that represents the display name of the field.
Class
Required. A constant long integer that represents the data type for the
field, such as string or integer. The Class parameter represents the
same values as the Field object s Type property. The following types are
allowed:
Type
property |
Description
|
Numeric
value |
OLE
variant type |
vbNull |
Null |
1 |
VT_NULL |
vbInteger |
Integer |
2 |
VT_I2 |
vbLong |
Long
integer |
3 |
VT_I4 |
vbSingle |
4-byte real
(floating point) |
4 |
VT_R4 |
vbDouble |
Double
(8-byte real) |
5 |
VT_R8 |
vbCurrency |
Currency |
6 |
VT_CY |
vbDate |
Date |
7 |
VT_DATE |
vbString |
String |
8 |
VT_BSTR |
vbBoolean |
Boolean |
11 |
VT_BOOL |
vbDataObject
|
Data object
|
13 |
VT_UNKNOWN |
vbBlob |
Blob |
65 |
VT_BLOB |
PropTag
Required.
Long. The property tag for the corresponding MAPI property.
value
Optional.
Variant. The value of the field, of the data type specified in the Class
parameter. When no value is supplied, no data is present for the object. You
must make subsequent calls to the Field object s ReadFromFile method.
PropsetID
Optional.
String. Specifies the identifier of the property set, represented as a string
of hexadecimal characters. When the identifier is not present, the property is
created within the default property set. The default property set is either the
property set specified to the SetNamespace
Remarks
Support for
the Add method is provider-dependent. The second syntax should be used
when adding a MAPI property to the Fields collection.
The name,
Class, and value parameters in the first syntax correspond to the
Name, Type, and Value properties of the Field
The PropTag
parameter in the second syntax contains the 32-bit MAPI property tag associated
with the property and corresponds to the ID
The Index
The field is
saved in the MAPI system when you Update the parent object, or Send
When you use
the vbBlob type, you supply the value in the form of a hexadecimal
string that contains the hexadecimal representation of the bytes in the binary
object (such as a hexadecimal dump of the object).
Note that
MAPI stores all custom properties that represent date and time information
using Greenwich Mean Time (GMT). The OLE Messaging Library converts these
properties so that the values appear to the user in local time.
The OLE
Messaging Library does not support MAPI properties of types PT_OBJECT and
PT_CLSID. All others, however, are available through the Fields collection.
Example
' Fragment from Fields_Add; uses the type
"vbString"
Set
objNewField = objFieldsColl.Add( _
Name:="Keyword", _
Class:=vbString, _
Value:="Peru")
' verify that
objNewField is a valid Field object
' Fragment from Field_Type; display the integer type
value
MsgBox
"Field type = " & objOneField.Type